<template>
    <table border="1">
        <tr>
            <td>会员等级名称</td>
            <td><input type="text" placeholder="请输入名称" v-model="info.Rank_Name"/></td>
        </tr>
        <tr>
            <td>会员等级状态</td>
            <td>
                <input type="radio" :value="true" v-model="info.Rank_State"/>启用
                <input type="radio" :value="false" v-model="info.Rank_State"/>禁用
            </td>
        </tr>
        <tr>
            <td>最小成长值</td>
            <td><input type="text" placeholder="请输入最小成长值" v-model="info.Rank_MinPoint"/></td>
        </tr>
        <tr>
            <td>最大成长值</td>
            <td><input type="text" placeholder="请输入最大成长值" v-model="info.Rank_MaxPoint"/></td>
        </tr>
        <tr>
            <td><input type="button" value="添加" @click="Add"/></td>
        </tr>
    </table>
</template>
<script setup lang="ts">

    import {ref,onMounted} from 'vue';
    import axios from 'axios';


    const info=ref({
         Rank_Name: "",
         Rank_State: true,
         Rank_MinPoint: 0,
         Rank_MaxPoint: 0
    });

    const Add=()=>{
        axios.post("https://localhost:7153/api/Member/AddMemberRank/AddMemberRank",info.value)
        .then(res=>{
            if(res.data>0){
                alert('添加成功');
            }
            else if(res.data==-1){
                alert('此用户已存在');
            }
            else{
                alert('添加失败');
            }
        })
        .catch(err=>{
            console.log(err);
        })
    }

</script>
